<%--
  Created by IntelliJ IDEA.
  User: lipengyu
  Date: 2022/11/12
  Time: 9:10
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>分页显示所有用户</title>
</head>
<body>
    <h1>所有用户</h1>
    <c:forEach var="user" items="${pageInfo.records}">
        用户id:${user.id}
        用户名：
        <a href="${pageContext.request.contextPath}/user/getById/?userId=${user.id}">${user.username}</a>
        用户角色：
        <c:if test="${user.power == 0}"> 超级管理员</c:if>
        <c:if test="${user.power == 1}">普通用户</c:if>
        <a href="${pageContext.request.contextPath}/user/${user.id}">修改</a>
        <form action="${pageContext.request.contextPath}/user" method="post">
            <input type="hidden" name="_method" value="delete">
            <input type="hidden" name="userId" value="${user.id}">
            <input type="submit" value="删除">
        </form>
        <hr>
    </c:forEach>

    <c:if test="${pageInfo.current!=1}">
        <a href="${pageContext.request.contextPath}/user/page/${pageInfo.current-1}">上一页</a>
    </c:if>

    当前${pageInfo.current}页
    总计${pageInfo.pages}页

    <c:if test="${pageInfo.current!=pageInfo.pages}">
        <a href="${pageContext.request.contextPath}/user/page/${pageInfo.current+1}">下一页</a>
    </c:if>

</body>
</html>
